home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 11 / FM Towns Free Software Collection 11.iso / t_os / tool / artemis2 / src / icondat.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-08-01  |  14.0 KB  |  365 lines

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <winb.h>
  5. #include <te.h>
  6. #include <fntb.h>
  7. #include <gui.h>
  8. #include "art.h"
  9. #include "icondat.h"
  10.  
  11. /* 自由点描、自由曲線、直線などの 24×24dot アイコン(ビットパターン) */
  12.  
  13. static unsigned char toolbox_icon[][24*24/8] =
  14. {
  15.     /* 自由点描 */
  16.     { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  17.       0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x01,0x98,0x00,0x01,0x80,
  18.       0x00,0x18,0x00,0x01,0x9b,0x00,0x01,0x83,0x00,0x00,0x30,0x00,
  19.       0x0c,0x31,0x80,0x0c,0x01,0x80,0x00,0x18,0x00,0x00,0x1b,0x00,
  20.       0x00,0x03,0x00,0x18,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,
  21.       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
  22.     /* 自由曲線 */
  23.     { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  24.       0x00,0x00,0x00,0x00,0x00,0xf8,0x00,0x07,0x00,0x00,0x08,0x00,
  25.       0x00,0x7c,0x00,0x01,0x92,0x00,0x02,0x21,0x00,0x04,0x21,0x00,
  26.       0x08,0x21,0x00,0x08,0x21,0x00,0x10,0x11,0x00,0x10,0x0e,0x00,
  27.       0x10,0x00,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  28.       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
  29.     /* 直線 */
  30.     { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  31.       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,
  32.       0x00,0x00,0x30,0x00,0x00,0xc0,0x00,0x03,0x00,0x00,0x0c,0x00,
  33.       0x00,0x30,0x00,0x00,0xc0,0x00,0x03,0x00,0x00,0x0c,0x00,0x00,
  34.       0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  35.       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
  36.     /* 長方形フィル */
  37.     { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  38.       0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xf8,0x15,0x55,0x58,
  39.       0x1a,0xaa,0xa8,0x15,0x55,0x58,0x1a,0xaa,0xa8,0x15,0x55,0x58,
  40.       0x1a,0xaa,0xa8,0x15,0x55,0x58,0x1a,0xaa,0xa8,0x15,0x55,0x58,
  41.       0x1a,0xaa,0xa8,0x1f,0xff,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,
  42.       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
  43.     // 楕円フィル
  44.     { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  45.       0x00,0x00,0x00,0x00,0xff,0x00,0x03,0x55,0xc0,0x06,0xaa,0xa0,
  46.       0x0d,0x55,0x50,0x0a,0xaa,0xb0,0x15,0x55,0x58,0x1a,0xaa,0xa8,
  47.       0x15,0x55,0x58,0x1a,0xaa,0xa8,0x0d,0x55,0x50,0x0a,0xaa,0xb0,
  48.       0x05,0x55,0x60,0x03,0xaa,0xc0,0x00,0xff,0x00,0x00,0x00,0x00,
  49.       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
  50.     // 楕円枠線
  51.     { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  52.       0x00,0x00,0x00,0x00,0xff,0x00,0x03,0x00,0xc0,0x04,0x00,0x20,
  53.       0x08,0x00,0x10,0x08,0x00,0x10,0x10,0x00,0x08,0x10,0x00,0x08,
  54.       0x10,0x00,0x08,0x10,0x00,0x08,0x08,0x00,0x10,0x08,0x00,0x10,
  55.       0x04,0x00,0x20,0x03,0x00,0xc0,0x00,0xff,0x00,0x00,0x00,0x00,
  56.       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
  57.     // 矩形枠線
  58.     { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  59.       0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0xff,0xf8,0x10,0x00,0x08,
  60.       0x10,0x00,0x08,0x10,0x00,0x08,0x10,0x00,0x08,0x10,0x00,0x08,
  61.       0x10,0x00,0x08,0x10,0x00,0x08,0x10,0x00,0x08,0x10,0x00,0x08,
  62.       0x10,0x00,0x08,0x1f,0xff,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,
  63.       0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
  64.     // 擦りペン
  65.     { 0x00,0x00,0x00,0x00,0x00,0x00,0x1c,0x1e,0x00,0x1c,0x0e,0x78,
  66.       0x0d,0xff,0xfc,0x0d,0x80,0x08,0x0d,0xfd,0xf0,0x07,0x66,0x60,
  67.       0x06,0x5d,0x40,0x7f,0x59,0xe0,0x14,0x92,0x38,0x04,0x37,0x80,
  68.       0x06,0xcf,0x00,0x07,0x00,0x00,0x06,0x3f,0xe0,0x0c,0x3e,0x60,
  69.       0x3c,0x06,0x00,0x34,0x06,0x40,0x14,0x62,0x30,0x04,0x67,0x18,
  70.       0x00,0x0f,0x18,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
  71.     // 矩形コピー
  72.     { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xf8,0x00,0x80,0x08,
  73.       0x00,0x80,0x08,0x00,0x80,0x08,0x00,0x80,0x08,0x1f,0xff,0x08,
  74.       0x10,0x01,0x08,0x10,0x01,0x08,0x10,0x00,0x88,0x10,0x01,0xc8,
  75.       0x10,0x0b,0x88,0x10,0x0f,0x08,0x10,0x0e,0x08,0x10,0x0f,0x08,
  76.       0x10,0x00,0xf8,0x10,0x01,0x00,0x10,0x01,0x00,0x10,0x01,0x00,
  77.       0x10,0x01,0x00,0x1f,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
  78.     // 領域塗りつぶし
  79.     { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x00,0x14,0x00,
  80.       0x00,0x22,0x00,0x00,0x41,0x00,0x00,0x80,0x80,0x01,0x00,0x40,
  81.       0x02,0x00,0x20,0x04,0x00,0x10,0x07,0xff,0xf8,0x04,0xff,0xf8,
  82.       0x04,0x7f,0xf0,0x04,0x3f,0xe0,0x04,0x1f,0xc0,0x04,0x0f,0x80,
  83.       0x04,0x07,0x00,0x04,0x00,0x00,0x0e,0x00,0x00,0x3f,0xf0,0x00,
  84.       0x3f,0xff,0xe0,0x1f,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
  85.     // 滲
  86.     { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0e,0x00,0x0e,0x0c,0x00,
  87.       0x0e,0x08,0x20,0x03,0x10,0x20,0x00,0x3f,0xf0,0x00,0x7a,0x30,
  88.       0x00,0x06,0x18,0x3c,0xff,0xfc,0x39,0xfe,0x80,0x20,0x18,0xc0,
  89.       0x00,0x11,0x60,0x00,0x37,0x70,0x01,0xee,0x3c,0x03,0xcc,0x9c,
  90.       0x06,0xc1,0x8c,0x1e,0x1f,0x20,0x1e,0x0e,0x40,0x1c,0x01,0x80,
  91.       0x0c,0x3f,0x00,0x04,0x1e,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
  92.     // 朦
  93.     { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x11,0x80,0x0d,0x11,0x80,
  94.       0x0f,0x7d,0xf8,0x09,0x65,0x00,0x09,0x2d,0xfc,0x0f,0x29,0xec,
  95.       0x09,0xfc,0x0c,0x0d,0x00,0xfc,0x0f,0x7d,0x80,0x09,0x4d,0x80,
  96.       0x09,0x45,0x78,0x19,0x7d,0xe0,0x19,0x4d,0x40,0x19,0x7d,0xf0,
  97.       0x19,0x4d,0x00,0x19,0x45,0xf0,0x1b,0x45,0x84,0x3b,0x5d,0x0c,
  98.       0x3b,0x5d,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
  99.     // 砂
  100.     { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0x80,0x00,0x03,0x80,
  101.       0x00,0x01,0x80,0x00,0x01,0x80,0x0f,0xc0,0xd0,0x06,0x04,0xd8,
  102.       0x06,0x08,0xc8,0x06,0x1a,0xcc,0x0d,0xb9,0x8c,0x0f,0x99,0x8c,
  103.       0x0d,0x80,0xac,0x19,0x80,0x20,0x39,0x80,0x40,0x2f,0x80,0xc0,
  104.       0x01,0x81,0x80,0x00,0x03,0x80,0x00,0x07,0x00,0x00,0x1e,0x00,
  105.       0x00,0x3c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
  106.     // ポリゴンフィル
  107.     { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,
  108.       0x00,0x06,0x80,0x00,0x3d,0x40,0x00,0xea,0xc0,0x07,0x55,0x40,
  109.       0x06,0xaa,0xa0,0x05,0x55,0x60,0x06,0xaa,0xa0,0x0d,0x55,0x50,
  110.       0x0a,0xaa,0xb0,0x0d,0x55,0x50,0x0a,0xaa,0xa8,0x0d,0x55,0x58,
  111.       0x0a,0xaa,0xa8,0x15,0x55,0x54,0x1a,0xaa,0xfc,0x15,0xff,0x80,
  112.       0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
  113.     // ポリゴンコピー
  114.     { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x60,0x00,0x01,0xa0,
  115.       0x00,0x0e,0x20,0x00,0x30,0x10,0x00,0x20,0x10,0x00,0x0c,0x10,
  116.       0x00,0x34,0x10,0x01,0xc4,0x10,0x06,0x00,0x88,0x04,0x01,0xc8,
  117.       0x04,0x0b,0x88,0x08,0x0f,0x08,0x08,0x0e,0x04,0x08,0x0f,0x04,
  118.       0x10,0x00,0x7c,0x10,0x01,0x00,0x10,0x01,0x00,0x20,0x00,0x80,
  119.       0x20,0x00,0x80,0x3f,0xff,0x80,0x00,0x00,0x00,0x00,0x00,0x00 },
  120.     // 拡大縮小矩形コピー
  121.     { 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0xf0,0x00,
  122.       0x10,0x10,0x00,0x10,0x10,0x00,0x13,0xff,0xf0,0x12,0x10,0x10,
  123.       0x12,0x10,0x10,0x12,0x10,0x10,0x12,0x10,0x10,0x12,0x10,0x10,
  124.       0x1f,0xf0,0x10,0x02,0x00,0x10,0x02,0x00,0x10,0x02,0x00,0x10,
  125.       0x02,0x00,0x10,0x02,0x00,0x10,0x02,0x00,0x10,0x02,0x00,0x10,
  126.       0x03,0xff,0xf0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 },
  127.     /* 終了マーク */
  128.     { 0xff,0xff,0xff }
  129. };
  130.  
  131. static unsigned char iconARTEMIS[] =
  132. /* 56×12dot */
  133. {
  134.     0x03,0x87,0xe7,0xfe,0x00,0x00,0x00, 0x03,0x86,0x10,0x60,0x00,0x00,0x00,
  135.     0x03,0x86,0x08,0x60,0x00,0x03,0x00, 0x04,0xc6,0x08,0x60,0x00,0x03,0x00,
  136.     0x04,0xc6,0x08,0x60,0x00,0x00,0x00, 0x04,0xc6,0x08,0x61,0xc7,0xb3,0x3e,
  137.     0x08,0x66,0x10,0x63,0x26,0x4b,0x60, 0x08,0x67,0xe0,0x66,0x16,0x4b,0x60,
  138.     0x0f,0xe6,0x20,0x67,0xf6,0x4b,0x3c, 0x10,0x36,0x30,0x66,0x06,0x4b,0x06,
  139.     0x10,0x36,0x10,0x63,0x06,0x4b,0x06, 0x10,0x36,0x18,0x61,0xe6,0x4b,0x7c
  140. };
  141.  
  142. static unsigned char icon_pensel[] =
  143. /* 38×38dot */
  144. {
  145.   0xff,0xff,0xff,0xff,0xfc, 0xff,0xff,0xff,0xff,0xfc, 0xc0,0x00,0x00,0x00,0x0c,
  146.   0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c,
  147.   0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c,
  148.   0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c,
  149.   0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c,
  150.   0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c,
  151.   0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c,
  152.   0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c,
  153.   0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c,
  154.   0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c,
  155.   0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c,
  156.   0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c, 0xc0,0x00,0x00,0x00,0x0c,
  157.   0xff,0xff,0xff,0xff,0xfc, 0xff,0xff,0xff,0xff,0xfc
  158. };
  159.  
  160. static unsigned char icon_colsel_off[] =
  161. /* 24×24dot */
  162. {
  163.     0xff,0xff,0xff, 0x80,0x00,0x01, 0x80,0x00,0x01, 0x80,0x00,0x01,
  164.     0x80,0x00,0x01, 0x80,0x00,0x01, 0x80,0x00,0x01, 0x80,0x00,0x01,
  165.     0x80,0x00,0x01, 0x80,0x00,0x01, 0x80,0x00,0x01, 0x80,0x00,0x01,
  166.     0x80,0x00,0x01, 0x80,0x00,0x01, 0x80,0x00,0x01, 0x80,0x00,0x01,
  167.     0x80,0x00,0x01, 0x80,0x00,0x01, 0x80,0x00,0x01, 0x80,0x00,0x01,
  168.     0x80,0x00,0x01, 0x80,0x00,0x01, 0x80,0x00,0x01, 0xff,0xff,0xff
  169. };
  170.  
  171. static unsigned char icon_colsel_on[] =
  172. /* 24×24dot */
  173. {
  174.     0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
  175.     0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
  176.     0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
  177.     0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
  178.     0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,
  179.     0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00, 0x00,0x00,0x00
  180. };
  181.  
  182. static unsigned char icon_winzoomup[] =
  183. {
  184.     0x00,0x00, 0x70,0xe0, 0x60,0x60, 0x50,0xa0, 0x09,0x00, 0x00,0x00,
  185.     0x00,0x00, 0x09,0x00, 0x50,0xa0, 0x60,0x60, 0x70,0xe0, 0x00,0x00
  186. };
  187.  
  188. static unsigned char icon_winzoomdown[] =
  189. {
  190.     0x00,0x00, 0x40,0x20, 0x29,0x40, 0x19,0x80, 0x39,0xc0, 0x00,0x00,
  191.     0x00,0x00, 0x39,0xc0, 0x19,0x80, 0x29,0x40, 0x40,0x20, 0x00,0x00
  192. };
  193.  
  194. static unsigned char icon_erasebtn[] =
  195. {
  196.     0x00,0x00, 0x00,0x00, 0x30,0xc0, 0x39,0xc0, 0x1f,0x80, 0x0f,0x00,
  197.     0x0f,0x00, 0x1f,0x80, 0x39,0xc0, 0x30,0xc0, 0x00,0x00, 0x00,0x00
  198. };
  199.  
  200. #define    ATR_UFRAME    0x000_0001
  201. #define    ATR_DFRAME    0x000_0002
  202. #define    ATR_EDGE    0x000_0004
  203. #define    ATR_ONLIGHT    0x000_0008
  204. #define    ATR_WHITE    0x000_0010
  205.  
  206.  
  207.  
  208. static void icon_setdot(int scr,char *buf,int wid,int ht,int x,int y,int col)
  209. {
  210.     unsigned int *coltbl;
  211.     coltbl = MG_getColorTable(scr);
  212.     if (scr==2)
  213.         *(short*) &buf[4+wid*y*2+x*2] = coltbl[col] & 0x7fff;
  214.     else if (scr==0)
  215.     {
  216.         char *p = buf + 4 + ((wid+7)/8) * 4 * y + x / 2;
  217.         *p = ((x&1)==0 ? (*p & 0xf0) | ( col       & 0x0f) :
  218.                          (*p & 0x0f) | ((col << 4) & 0xf0));
  219.     }
  220.     else if (scr==3)
  221.     {
  222.         char *p = buf + 4 + (wid*y+x)*3;
  223.         uint c = coltbl[col] & 0xffffff;
  224.         p[0] = c & 0xff;
  225.         p[1] = (c >> 8) & 0xff;
  226.         p[2] = (c >> 16) & 0xff;
  227.     }
  228. }
  229.  
  230. static int icon_chkbit(unsigned char *bitbuf,int wid,int ht,int x,int y)
  231. {
  232.     int bitpat,mask;
  233.     bitpat = bitbuf[ ((wid+7)/8) * y + (x >> 3) ];
  234.     mask   = 0x80U >> (x & 7);
  235.     if ((bitpat & mask) != 0 )
  236.         return 1;
  237.     else
  238.         return 0;
  239. }
  240.  
  241. static char *icon_allocbuf(int scr,int wid, int ht)
  242. {
  243.     int size = 1;
  244.     if (scr == 0)
  245.         size = 4 + ((wid+7)/8)*4*ht;
  246.     else if (scr == 2)
  247.         size = 4 + wid*ht*2;
  248.     else if (scr == 3)
  249.         size = 4 + wid*ht*3;
  250.     return TL_calloc(size,1);
  251. }
  252.  
  253. static unsigned char *makeicondat(unsigned char *bitpat,int wid,int ht,int atr)
  254. {
  255.     SCREEN scr;
  256.     char *buf;
  257.     int i,j;
  258.     int piccol;
  259.   /* 画面モード、カラー変換テーブルの取得 */
  260.     MMI_GetScreen(&scr);
  261.   /* グラフィックデータ領域の確保 */
  262.     if ((buf = icon_allocbuf(scr.mode, wid,ht)) == NULL)
  263.         return NULL;
  264.   /* パターンの大きさ、色数のパラメータ設定 */
  265.     buf[0] = wid;
  266.     buf[1] = ht;
  267.     buf[2] = 0;
  268.     buf[3] = (scr.mode == 0 ? 4 : scr.mode == 2 ? 16 : scr.mode == 3 ? 24 : 0);
  269.   /* パターンデータのビットをチェックするマクロ */
  270.     #define SETDOT(x,y,col)  icon_setdot(scr.mode, buf, wid,ht,x,y,col)
  271.     #define CHKBIT(x,y)         icon_chkbit(bitpat, wid,ht,x,y)
  272.   /* 全体を灰色(または白)に塗る */
  273.     for (i=0; i<ht; i++)
  274.         for (j=0; j<wid; j++)
  275.         {
  276.             int col;
  277.             if (atr & ATR_WHITE)
  278.                 col = WHITE;
  279.             else if (atr & ATR_ONLIGHT)
  280.                 col = DARKGRAY;
  281.             else
  282.                 col = GRAY;
  283.             SETDOT(j,i,col);
  284.         }
  285.   /* 枠を描く */
  286.     if (atr & ATR_UFRAME)
  287.     {
  288.         for (i=0; i<wid; i++)    SETDOT(i,0,LIGHT);
  289.         for (i=0; i<ht; i++)    SETDOT(0,i,LIGHT);
  290.         for (i=1; i<wid; i++)    SETDOT(i,ht-1,SHADOW);
  291.         for (i=1; i<ht; i++)    SETDOT(wid-1,i,SHADOW);
  292.     }
  293.     if (atr & ATR_DFRAME)
  294.     {
  295.         for (i=0; i<wid-1; i++)    SETDOT(i,0,SHADOW);
  296.         for (i=0; i<ht-1; i++)    SETDOT(0,i,SHADOW);
  297.         for (i=0; i<wid; i++)    SETDOT(i,ht-1,LIGHT);
  298.         for (i=0; i<ht; i++)    SETDOT(wid-1,i,LIGHT);
  299.     }
  300.     if (atr & ATR_ONLIGHT)
  301.         piccol = 13;
  302.     else
  303.         piccol = 8;
  304.   /* 絵柄を描く */
  305.     if (bitpat != NULL)
  306.     {
  307.         for (i=0; i<ht; i++)
  308.             for (j=0; j<wid; j++)
  309.             {
  310.                 if (CHKBIT(j,i))
  311.                     SETDOT(j,i,piccol);
  312.                 else if ((atr & ATR_EDGE) && j > 0 && CHKBIT(j-1,i))
  313.                     SETDOT(j,i,LIGHT);
  314.             }
  315.     }
  316.   /* 終了 */
  317.     #undef CHKBIT
  318.     #undef SETDOT
  319.     return (unsigned char*)buf;
  320. }
  321.  
  322. #define    ICN_TBLNUM    (ICN_MAXNUM+1-512)
  323.  
  324. static unsigned char *icon_table[ICN_TBLNUM];
  325.  
  326. int set_icontable(void)
  327. {
  328.     int i,datcnt;
  329.     for (i=0; i<ICN_TBLNUM; i++)
  330.         icon_table[i] = NULL;
  331.   /* ARTemis アイコン */
  332.     icon_table[ICN_ARTEMIS-512] = makeicondat(iconARTEMIS,56,12,ATR_EDGE);
  333.   /* ツールボックスアイコン */
  334.     for (datcnt=0; ; datcnt++)
  335.     {
  336.         if (toolbox_icon[datcnt][0] == 0xff)
  337.             break;
  338.         icon_table[ICN_TOOLBOX-512 + datcnt * 2] =
  339.             makeicondat(toolbox_icon[datcnt],24,24,ATR_UFRAME);
  340.         icon_table[ICN_TOOLBOX-512 + datcnt * 2 + 1] =
  341.             makeicondat(toolbox_icon[datcnt],24,24,ATR_DFRAME | ATR_ONLIGHT);
  342.     }
  343.   /* ペン選択ボタン・仮イメージ */
  344.     for (i=0; i<ICN_PENSEL_N; i++)
  345.     {
  346.         icon_table[ICN_PENSEL-512+i*2  ] =
  347.             makeicondat(NULL,38,38,ATR_WHITE);
  348.         icon_table[ICN_PENSEL-512+i*2+1] =
  349.             makeicondat(icon_pensel,38,38,ATR_WHITE);
  350.     }
  351.   /* 色選択ボタン */
  352.     icon_table[ICN_COLSEL-512] = makeicondat(icon_colsel_off,24,24,ATR_WHITE);
  353.     icon_table[ICN_COLSEL-512+1]=makeicondat(icon_colsel_on,24,24,ATR_WHITE);
  354.   /* サイズボタン */
  355.     icon_table[ICN_WINZOOMUP  -512] = makeicondat(icon_winzoomup,  12,12,0);
  356.     icon_table[ICN_WINZOOMDOWN-512] = makeicondat(icon_winzoomdown,12,12,0);
  357.   /* イレーズボタン */
  358.     icon_table[ICN_ERASEBTN-512]=makeicondat(icon_erasebtn,12,12,ATR_EDGE);
  359.   /* アイコンテーブルを設定 */
  360.     MMI_SetIconTable( icon_table, ICN_MAXNUM );
  361.     return 0;
  362.    ERROR:
  363.     return -1;
  364. }
  365.